<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MinumanControllers extends CI_Controller {

  
	public function tambah_minuman(){
	$data = array( 
		'nama' => $this->input->post('nama'),
		'bahan' => $this->input->post('bahan'),
		'cara' => $this->input->post('cara'),
	);
	$this->load->model('minuman');
	$this->minuman->addMinuman($data);
	$this->data['minuman'] = $this->minuman->get_minuman();
		$this->data['page'] = 'minuman';
		$this->data['title'] = 'Daftar Minuman';
		$this->load->view('dashboard', $this->data);
	} 

	public function edit($id){
	$this->load->model('minuman');
		$this->data['minuman'] = $this->minuman->EditMinuman($id);
		$this->data['page'] = 'editminuman';
		$this->data['title'] = 'Edit Minuman';
		$this->load->view('dashboard', $this->data);

	}
	public function updtminuman($id){
		$data = array( 
		'nama' => $this->input->post('nama'),
		'bahan' => $this->input->post('bahan'),
		'cara' => $this->input->post('cara'),
		);
		$this->load->model('minuman');
		$this->minuman->updateMinuman($id,$data);
		$this->data['minuman'] = $this->minuman->get_minuman();
		$this->data['page'] = 'minuman';
		$this->data['title'] = 'Daftar Minuman';
		$this->load->view('dashboard', $this->data);
		
	}

	public function delete($id){
		$this->load->model('minuman');
		$this->minuman->hapus($id);
		$this->data['minuman'] = $this->minuman->get_minuman();
		$this->data['page'] = 'minuman';
		$this->data['title'] = 'Daftar Minuman';
		$this->load->view('dashboard', $this->data);

	}
  }